package com.pay.center.common.enums;

/**
 * 支付渠道的枚举
 */
public enum PayChannelEnum {
    

    //列出所有的常量
    ALIPAY("alipay","支付宝"),
    WECHAT_PAY("wechatPay","微信支付");

    private String code;
    private String msg;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }



    /**
     * 枚举的构造方法
     * @param code
     * @param msg
     */
    PayChannelEnum(String code,String msg){

        this.code = code;
        this.msg = msg;
    }

    /**
     * 根据code获取msg
     * @param code
     * @return
     */
    public String getMsg(String code){

        for (PayChannelEnum payChannelEnum:PayChannelEnum.values()){
                if (code.equals(payChannelEnum.getCode())){
                    return payChannelEnum.msg;
                }
        }

        return null;

    }



}
